<meta http-equiv="Content-Type" content="text/html; charset=utf-8" />
<!--<style type="text/css">
	.submit{
		background:#CCCCCC;
		color:#FF0000;
		font-weight:bold;
		padding: 2px 15px 2px 15px;
	}
	.submit:hover{
		background:#000099;
		color:#fff;
		font-weight:bold;
		padding: 2px 15px 2px 15px;
	}
	.input{
		width: 250px;
		height: 25px;
		border:#CCCCCC 1px solid;
		margin-bottom: 5px;
	}
	.input:hover{
		width: 250px;
		height: 25px;
		border:#FFCC00 1px solid;
		margin-bottom: 5px;
	}
	.select{
		border:#CCCCCC 1px solid;
		margin-bottom: 5px;
	}
	.select:hover{
		border:#FFCC00 1px solid;
		margin-bottom: 5px;
	}
</style>-->

<link rel="stylesheet" href="style/form.css" />
<link rel="stylesheet" href="style/style.css" />

<div style="margin-left: 120px; margin-top: 20px">
	<form action="actionregister.php" method="post" name="frmRegister" id="frmRegister" onsubmit="return checkRegister()">
		<table width="700" cellpadding="5" cellspacing="5" border="0">
			<tr>
				<td colspan="2" style="color:#FF0000; font-size:18px">THÔNG TIN ĐĂNG NHẬP </td>
			</tr>
			<tr><td colspan="2">&nbsp;</td></tr>
			<tr>
				<td>Cá nhân/Doanh nghiệp&nbsp;<i style="color:#FF0000">*</i></td>
				<td style="width: 250px;">
				Cá nhân<input type="radio" class="styled" value="register.php" <?php echo 'checked'; ?> name="type"/> 
                Doanh Nghiệp<input type="radio" class="styled" value="register_doanhnghiep.php" name="type" onchange="changePage(this.value)"/>
					<script language="javascript">
						function changePage(vl)
						{
							window.location.href=vl;
						}
					</script>
				</td>
                <td width="200"></td>
			</tr>
			<tr>
				<td>Email của bạn&nbsp;<i style="color:#FF0000">*</i></td> <?php echo $_POST['type']; ?>
				<td><input type="text" name="email" id="email" class="textInputreg" onChange="check_email(this.name)"/> </td>	
                <td align="left" style="color:red; font-size: 12px;" valign="middle"><div id="noteemail"></div></td>
			</tr>
			<tr>
				<td>Mật khẩu&nbsp;<i style="color:#FF0000">*</i></td>
				<td><input type="password" name="password" id="password" class="textInputreg"  onChange="check_password(this.name)"/></td>
                <td align="left" style="color:red; font-size: 12px;" valign="middle"><div id="notepassword"></div></td>
			</tr>
			<tr>
				<td>Xác nhận mật khẩu&nbsp;<i style="color:#FF0000">*</i></td>
				<td><input type="password" name="confirmpass" id="confirmpass" class="textInputreg"  onChange="check_confirmpass(this.name)"/></td>
                <td align="left" style="color:red; font-size: 12px;" valign="middle"><div id="noteconfirmpass"></div></td>
			</tr>
			
            
			<tr>
				<td>Họ&nbsp;<i style="color:#FF0000">*</i></td>
				<td><input type="text" name="firstname" id="firstname" class="textInputreg" onChange="check_firstname(this.name)"/></td>
                <td align="left" style="color:red; font-size: 12px;" valign="middle"><div id="notefirstname"></div></td>
			</tr>
			<tr>
				<td>Tên&nbsp;<i style="color:#FF0000">*</i></td>
				<td><input type="text" name="lastname" id="lastname" class="textInputreg" onChange="check_lastname(this.name)"/></td>
                <td align="left" style="color:red; font-size: 12px;" valign="middle"><div id="notelastname"></div></td>
			</tr>
			<tr>
				<td>Giới tính</td>
				<td>Nam<input type="radio" class="styled" value="Nam" checked="checked" name="sex"/>Nữ<input type="radio" class="styled" value="Nữ" name="sex" /></td>
			</tr>
			<tr>
				<td>Ngày tháng năm sinh</td>
				<td>
				<select name="day"select id="birthdate1">
					<option value="">-- Chọn --</option>
					<?php
						for($i=1; $i<32; $i++)
						{
						?>
							<option value="<?php echo $i;?>"><?php echo $i;?></option>
					<?php }?>
				</select><select name="month" class="select" id="birthdate1">
					<option value="">-- Chọn --</option>
					<?php
						for($i=1; $i<13; $i++)
						{
						?>
							<option value="<?php echo $i;?>"><?php echo $i;?></option>
					<?php }?>
				</select><select name="year" class="select" id="birthdate1">
					<option value="">-- Chọn --</option>
					<?php
						for($i=1950; $i<2000; $i++)
						{
						?>
							<option value="<?php echo $i;?>"><?php echo $i;?></option>
					<?php }?>
				</select>
				</td>
			</tr>
			<tr>
				<td>CMND</td>
				<td>
					<input type="text" name="cmnd" class="textInputreg" />
					
				</td>
			</tr>
			<tr>
				<td>Điện thoại&nbsp;<i style="color:#FF0000">*</i></td>
				<td><input type="text" name="phone" id="phone" class="textInputreg" onChange="check_phone(this.name)"/></td>
                <td align="left" style="color:red; font-size: 12px;" valign="middle"><div id="notephone"></div></td>
			</tr>
			<tr>
				<td>Địa chỉ</td>
				<td><input type="text" name="address" class="textInputreg" /></td>
			</tr>
			<tr>
				<td>Tỉnh thành</td>
				<td>
					<select size="1" name="country" id="region"><option value="Select City" selected="selected">Chọn tỉnh thành</option><option value="Bai Chay">Bai Chay</option><option value="Ben Tre">Ben Tre</option><option value="Da Kao">Da Kao</option><option value="Da La City">Da La City</option><option value="Da Lat">Da Lat</option><option value="Da Lat Town">Da Lat Town</option><option value="Da Nang">Da Nang</option><option value="Dong Ha">Dong Ha</option><option value="Dong Hoi">Dong Hoi</option><option value="Ha Long">Ha Long</option><option value="Ha Long Bay">Ha Long Bay</option><option value="Ha Noi">Ha Noi</option><option value="Hai Phong">Hai Phong</option><option value="Haiphong">Haiphong</option><option value="Hanoi">Hanoi</option><option value="Hoi An">Hoi An</option><option value="Hoi An City">Hoi an City</option><option value="Hue">Hue</option><option value="Lang Co Town">Lang Co Town</option><option value="Lao Cai">Lao Cai</option><option value="Nha Trang">Nha Trang</option><option value="Nha Trang City">Nha Trang City</option><option value="Nhatrang">Nha Trang</option><option value="Ninh Binh">Ninh Binh</option><option value="Phan Thiet">Phan Thiet</option><option value="Quy Nhon">Quy Nhon</option><option value="Sa Pa">Sa Pa</option><option value="Sapa">Sapa</option><option value="Thanh pho Ho Chi Minh">Thanh pho Ho Chi Minh</option><option value="Thua Thien Hue">Thua Thien Hue</option><option value="Tuyen Quang Province">Tuyen Quang Province</option><option value="Van Dien">Van Dien</option></select>
				</td>
			</tr>
			<tr><td colspan="2"><input type="checkbox" name="check" id="check" />Tôi trên 18 tuổi và đã đọc kỹ điêu khoản hợp đồng</td>
            	<td align="left" style="color:red; font-size: 12px;" valign="middle"><div id="noteagreement"></div></td>
            </tr>
			<tr><td colspan="2">&nbsp;</td></tr>
			<tr>
				<td colspan="2"><input type="submit" class="textReg" value="Gia nhập BidBiz">
                <input type="reset" class="textReg" value="Reset"></td>
			</tr>
		</table>
	</form>
</div>
 <script type="text/javascript">
	function checkRegister(){
		document.getElementById("noteemail").innerHTML = '';
		document.getElementById("notepassword").innerHTML = '';
		document.getElementById("noteconfirmpass").innerHTML = '';
		document.getElementById("notefirstname").innerHTML = '';
		document.getElementById("notelastname").innerHTML = '';
		document.getElementById("notephone").innerHTML= '';
		document.getElementById("noteagreement").innerHTML= '';
		
		var type_register=document.getElementById('type_register');
		var email=document.getElementById('email');
		var filter = /^([a-zA-Z0-9_\.\-])+\@(([a-zA-Z0-9\-])+\.)+([a-zA-Z0-9]{2,4})+$/;
		
		var password=document.getElementById('password');
		var confirmpass=document.getElementById('confirmpass');
		var username=document.getElementById('username');
		var firstname=document.getElementById('firstname');
		var lastname=document.getElementById('lastname');
		var phone=document.getElementById('phone');
        var tencongty = document.getElementById('tencongty');
        
		var flag = 0;
		var fc = 0;
		
		if(email.value==''){
			var div_control = document.getElementById("noteemail");
			div_control.innerHTML = "<i>  Required field</i>";
			email.focus();
			fc = 1;
			flag = 1;
		}
		if (!filter.test(email.value)){
			var div_control = document.getElementById("noteemail");
			div_control.innerHTML = "<i>  Not avalible</i>";
			if(fc == 0)
			{
				email.focus();
				fc = 1;
			}
			flag = 1;
		}
		if(password.value==''){
			var div_control = document.getElementById("notepassword");
			div_control.innerHTML = "<i>  Required field</i>";
			
			if(fc == 0)
			{
				password.focus();
				fc = 1;
			}
			flag = 1;
		}
		if(confirmpass.value=='' || confirmpass.value != password.value){
			var div_control = document.getElementById("noteconfirmpass");
			div_control.innerHTML = "<i>  Confirm incorrectly</i>";
			
			if(fc == 0)
			{
				confirmpass.focus();
				fc = 1;
			}
			flag = 1;
		}
		if(firstname.value==''){
			var div_control = document.getElementById("notefirstname");
			div_control.innerHTML = "<i>  Required field</i>";
			
			if(fc == 0)
			{
				firstname.focus();
				fc = 1;
			}
			flag = 1;
		}
		if(lastname.value==''){
			var div_control = document.getElementById("notelastname");
			div_control.innerHTML = "<i>  Required field</i>";
			
			if(fc == 0)
			{
				lastname.focus();
				fc = 1;
			}
			flag = 1;
		}
		if(phone.value==''){
			var div_control = document.getElementById("notephone");
			div_control.innerHTML = "<i>  Required field</i>";
			
			if(fc == 0)
			{
				phone.focus();
				fc = 1;
			}
			flag = 1;
		}
		if (!check.checked)
		{
			var div_control = document.getElementById("noteagreement");
			div_control.innerHTML = "<i>  Required checked</i>";
			
			if(fc == 0)
			{
				check.focus();
				fc = 1;
			}
			flag = 1;
		}
		
		if (flag == 1)
			return false;
	}
</script>